Ext.ux.CommentPanel = function() {
	var desktop = MyDesktop.getDesktop();
	var item_comment = desktop.getWindow('comment-win');
	if (!item_comment) {
		var _jsonReader1 = new Ext.data.JsonReader({
					root : 'results',
					totalProperty : 'totalCount'
				}, [{
						name : 'commentId'
					}, {
						name : 'mobile'
					}, {
						name : 'commentContent'
					}, {
						name : 'commentTime'
					}, {
						name : 'commentStatus'
					}]);
		var ds1 = new Ext.data.Store({
			proxy : new Ext.data.HttpProxy({
						url : '/admin/comment.jhtml?method=getComments&pid='+publicCId+'&type='+commentType
					}),
			reader : _jsonReader1
		});
		
		var isPass = function(value) {
			if (value == 1) {
				return '<span style="color:green;font-weight:bold;">是</span>';
			} else {
				return '<span style="color:red;font-weight:bold;">否</span>';
			}
		};
		var cover_date = function(value) {
			if (value == null || value == 0) {
				return 'null';
			} else {
				return Ext.util.Format.date(new Date(parseInt(value)),	'Y-m-d H:i:s');
			}
		};
		var cm1 = new Ext.grid.ColumnModel([new Ext.grid.RowNumberer(),
				new Ext.grid.CheckboxSelectionModel(), {
						header : "编号",
						width : 50,
						sortable : true,
						dataIndex : 'commentId'
				}	, {
						header : "手机号",
						width : 100,
						sortable : true,
						dataIndex : 'mobile'
					}, {
						header : "内容",
						sortable : true,
						dataIndex : 'commentContent'
					}, {
						header : "时间",
						sortable : true,
						dataIndex : 'commentTime',
						renderer:cover_date
					}, {
						header : "是否通过",
						sortable : true,
						dataIndex : 'commentStatus',
						renderer:isPass
					}]);
		var grid1 = new Ext.grid.GridPanel({
			region : "center",
			cm : cm1,
			sm : new Ext.grid.CheckboxSelectionModel(),
			border : false,
			loadMask : {
				msg : "数据加载中，请稍等..."
			},
			store : ds1,
			viewConfig : {
				forceFit : true
			},
			bbar : new Ext.PagingToolbar({
						pageSize : 20,
						store : ds1,
						displayInfo : true
					}),
			tbar : [{
			text : '审批',
			tooltip : '审批一条',
			iconCls : 'add',
			handler : function() {
				var rows = grid1.getSelectionModel().getSelections();// 返回值为
				if (rows.length == 0) {
					getAlertMessage("提示","最少选择一条信息，进行操作!",Ext.MessageBox.WARNING);
				} else {
					for (var i = 0; i < rows.length; i++) {
						var conn = new Ext.data.Connection();
						conn.request({
									url : '/admin/comment.jhtml?method=updatedownloadFile',
									params : {
										commentId : rows[i].get("commentId")
									},
									success : function(resp, opt) {
									},
									failure : function(resp, opt) {
										Ext.Msg.alert('Error',
												'Unable to update movie');
									}
								});
					}
					loadDs(ds1,20);

				} // 弹出对话框警告
			}
		
			},'-',{
			text : '删除',
			tooltip : '删除选中的一条信息',
			iconCls : 'remove',
			handler : function() {
				var rows = grid1.getSelectionModel().getSelections();// 返回值为
				if (rows.length == 0) {
					getAlertMessage("提示","最少选择一条信息，进行操作!",Ext.MessageBox.WARNING);
				}else{
					Ext.MessageBox.confirm('提示框', '您确定要进行该操作？', function(btn) {
						if (btn == 'yes') {
							if (rows) {
								for (var i = 0; i < rows.length; i++) {
									var conn = new Ext.data.Connection();
									conn.request({
										url : '/admin/comment.jhtml?method=deleteComment',
										params : {
											commentId : rows[i].get("commentId")
										},
										success : function(resp, opt) {
										},
										failure : function(resp, opt) {
											Ext.Msg.alert('Error',
													'Unable to delete movie');
										}
									});
								}
					loadDs(ds1,20);
							}
						}
					});
				}
			}
			}]
		});
		item_comment = desktop.createWindow({
					id : 'comment-win',
					title : '评论管理',
					width : 740,
					height : 480,
					iconCls : 'icon-grid',
					shim : false,
					animCollapse : false,
					constrainHeader : true,
					layout : 'fit',
					items : grid1
				});
	}
		loadDs(ds1,20);
	item_comment.show();
}